#include "sdkGlobal.h"
#include "platform_global.h"

typedef struct
{
    TmsNewVersionFunc mTmsNewVersionFunc;
    WirelessModuleFirmwareUrlFunc mWirelessModuleFirmwareUrlFunc;
    DownloadTmsDataFunc mDownloadTmsDataFunc;
    DownloadCompleteNotifyFun mDownloadCompleteNotifyFun;
    NoDownloadNotifyFun mNoDownloadNotifyFun;
    BeforeStartTmsFunc mBeforeStartTmsFunc;
    BeforeEndTmsFunc mBeforeEndTmsFunc;
    HandleTmsErrReponseFunc mHandleTmsErrReponseFunc;
} platform_tms_entity;

static platform_tms_entity g_platform_tms_entity;

void platform_tms_init()
{
    memset(&g_platform_tms_entity, 0x00, sizeof(platform_tms_entity));
}

void platform_tms_set_new_version_func(TmsNewVersionFunc func)
{
    g_platform_tms_entity.mTmsNewVersionFunc = func;
}

TmsNewVersionFunc platform_tms_get_new_version_func()
{
    return g_platform_tms_entity.mTmsNewVersionFunc;
}

void platform_tms_set_wireless_module_url_func(WirelessModuleFirmwareUrlFunc func)
{
    g_platform_tms_entity.mWirelessModuleFirmwareUrlFunc = func;
}

WirelessModuleFirmwareUrlFunc platform_tms_get_wireless_module_url_func()
{
    return g_platform_tms_entity.mWirelessModuleFirmwareUrlFunc;
}


void platform_tms_set_download_data_func(DownloadTmsDataFunc func)
{
    g_platform_tms_entity.mDownloadTmsDataFunc = func;
}

DownloadTmsDataFunc platform_tms_get_download_data_func()
{
    return g_platform_tms_entity.mDownloadTmsDataFunc;
}

void platform_tms_set_download_complete_notify_func(DownloadCompleteNotifyFun func)
{
    g_platform_tms_entity.mDownloadCompleteNotifyFun = func;
}

DownloadCompleteNotifyFun platform_tms_get_download_complete_notify_func()
{
    return g_platform_tms_entity.mDownloadCompleteNotifyFun;
}

void platform_tms_set_no_download_notify_func(NoDownloadNotifyFun func)
{
    g_platform_tms_entity.mNoDownloadNotifyFun = func;
}

NoDownloadNotifyFun platform_tms_get_no_download_notify_func()
{
    return g_platform_tms_entity.mNoDownloadNotifyFun;
}

void platform_tms_set_before_start_tms_func(BeforeStartTmsFunc func)
{
    g_platform_tms_entity.mBeforeStartTmsFunc = func;
}

BeforeStartTmsFunc platform_tms_get_before_start_tms_func()
{
    return g_platform_tms_entity.mBeforeStartTmsFunc;
}

void platform_tms_set_before_end_tms_func(BeforeEndTmsFunc func)
{
    g_platform_tms_entity.mBeforeEndTmsFunc = func;
}

BeforeEndTmsFunc platform_tms_get_before_end_tms_func()
{
    return g_platform_tms_entity.mBeforeEndTmsFunc;
}

void platform_tms_set_handle_tms_err_response_func(HandleTmsErrReponseFunc func)
{
    g_platform_tms_entity.mHandleTmsErrReponseFunc = func;
}

HandleTmsErrReponseFunc platform_tms_get_handle_tms_err_response_func()
{
    return g_platform_tms_entity.mHandleTmsErrReponseFunc;
}
